//利用闭包根据字段排序商品
const lessions = [
  {
    title: "课程1",
    click: 50,
    price: 40
  },
  {
    title: "课程2",
    click: 30,
    price: 110
  },
  {
    title: "课程3",
    click: 80,
    price: 70
  },
]
const closur1 = (field) => {
  return (a, b) => a[field] - b[field]
}
console.table(lessions.sort(closur1("click")));

//使用闭包获取区间的值
const lists = [1, 2, 3, 4, 22, 33, 5, 65, 7, 8, 9, 0]
const closur2 = (m, n) => {
  return v => v > m && v < n
}
console.log(lists.filter(closur2(5,10)));

